package cn.hp.controller;
import cn.hp.entity.UserRole;
import cn.hp.service.UserRoleService;
import cn.hp.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Controller
 * /api/userRole
 */
@RestController
@RequestMapping("/api/userRole")
public class UserRoleController
{
    @Autowired
    private UserRoleService userRoleService;
    @GetMapping("/getUserRole")
    public Object getUserRole(UserRole obj) {
        List<UserRole> list = userRoleService.selectUserRoleList(obj);
        String [] roleIds = new String[list.size()];
        for (int i = 0; i < list.size(); i++) {
            UserRole userRole = list.get(i);
            roleIds[i]=userRole.getRoleId()+":"+userRole.getDescription();
        }
        return Result.success(roleIds);
    }
}